﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Login
/// </summary>
public class Login
{
    ForumDataContext dc;
    public Login(ForumDataContext d1)
	{
        dc = d1;
	}
    public int tryLogin(string username, string password)
    {
        var p1 = from p in dc.Uzytkownicies where p.nick == username && p.haslo == password select p;
        foreach (var rec1 in p1) return rec1.id_uzytkownik;

        return -1;
    }
}